const {resolve} = require('path');
const HTMLWebpackPlugin = require('html-webpack-plugin')
const MiniCssExtractPlugin = require('mini-css-extract-plugin')

module.exports = {
	entry: './index.js',
	output: {
		path: resolve(__dirname, '../dist'),
		filename: 'js/index.js',
		clean: true
	},
	module: {
		rules: [
			{
				test: /\.css$/,
				use: [
					{
						loader: MiniCssExtractPlugin.loader
					},

					'css-loader'
				]
			}
		]
	},
	plugins: [
		new HTMLWebpackPlugin({
			template: './index.html'
		}),
		new MiniCssExtractPlugin()
	]
}
